package com.cr.front.audit.dao.repository.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.cr.front.audit.dao.mapper.AuthenticationAuditMapper;
import com.cr.front.audit.dao.mapper.DriverLicenseAuditMapper;
import com.cr.front.audit.dao.repository.AuditRepository;
import com.cr.front.audit.pojo.dto.AuditSaveParam;
import com.cr.front.audit.pojo.entity.AuthenticationAudit;
import com.cr.front.audit.pojo.entity.DriverLicenseAudit;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

@Repository
public class AuditRepositoryImpl implements AuditRepository {
    @Autowired
    private AuthenticationAuditMapper authenticationAuditMapper;
    @Autowired
    private DriverLicenseAuditMapper driverLicenseAuditMapper;
    @Override
    public void addAuthenticationAudit(AuditSaveParam auditSaveParam) {
        AuthenticationAudit authenticationAudit = new AuthenticationAudit();
        BeanUtils.copyProperties(auditSaveParam,authenticationAudit);
        authenticationAudit.setAuditStatus(1);
        authenticationAuditMapper.insert(authenticationAudit);

    }

    @Override
    public void addDriverLicenseAudit(AuditSaveParam auditSaveParam) {
        DriverLicenseAudit driverLicenseAudit = new DriverLicenseAudit();
        BeanUtils.copyProperties(auditSaveParam,driverLicenseAudit);
        driverLicenseAudit.setAuditStatus(1);
        driverLicenseAuditMapper.insert(driverLicenseAudit);
    }
}
